<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <body>

        <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                        template="./AdminTemplate.xhtml">
            <ui:define name="Title">
                <title>Add Employee</title>
            </ui:define>

            <ui:define name="content">
                <h:form>
                    <div id="contenner" style="text-align: center;margin-top: 50px">
                        <!--                    <p:panel id="p1" rendered="{adminVihicleBean.emp.position==1}" header="Add Order" footer="order">-->

                        <h:panelGrid rendered="#{adminVihicleBean.emp.position==1}">
                            <h:column>
                                <h1>Add Employee </h1>
                                <div id="content" style="margin: 10px auto;width: 700px">
                                    <p:growl id="msgs" showDetail="true"/> 
                                    <table id="tblCusInfo">
                                        <tr>
                                            <td>
                                                <h4 style="width: 160px; color: #191919" >User Name :<strong style="color: red">*</strong> </h4>
                                            </td>
                                            <td>
                                                <p:inputText  id="username" value="#{adminVihicleBean.empAdd.userName}" style="width: 250px" required="true" requiredMessage="Please insert  User name">
                                                    <f:validateLength for="username" minimum="5" />
                                                </p:inputText>
                                            </td>
                                            <td>
                                                <p:message for="username"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <h4 style="width: 160px; color: #191919" >Password :<strong style="color: red">*</strong> </h4>
                                            </td>
                                            <td>

                                                <p:password  id="password" value="#{adminVihicleBean.empAdd.password}" style="width: 250px" required="true" requiredMessage="Please insert password">
                                                    <f:validateLength for="password" minimum="5" />
                                                </p:password>
                                            </td>
                                            <td>
                                                <p:message  for="password" />
                                            </td>
                                        </tr>

                                        <tr>
                                            <td>
                                                <h4 style="width: 160px; color: #191919" >Full Name :<strong style="color: red">*</strong> </h4>
                                            </td>
                                            <td>
                                                <p:inputText  id="fullname" value="#{adminVihicleBean.empAdd.fullName}" style="width: 250px" required="true" requiredMessage="Please insert fullname">
                                                    <f:validateLength for="fullname" minimum="5" />
                                                </p:inputText>
                                            </td>
                                            <td>
                                                <p:message for="fullname"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <h4 style="width: 160px; color: #191919" >Phone Number :<strong style="color: red">*</strong> </h4>
                                            </td>
                                            <td>
                                                <p:inputText  id="phone" value="#{adminVihicleBean.empAdd.phone}" style="width: 250px" required="true" requiredMessage="Please insert  phome">
                                                    <f:validator validatorId="checkvalidphone"/>
                                                </p:inputText>
                                            </td>
                                            <td>
                                                <p:message for="phone"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <h4 style="width: 160px; color: #191919" >Email :<strong style="color: red">*</strong> </h4>
                                            </td>
                                            <td>
                                                <p:inputText  id="email" value="#{adminVihicleBean.empAdd.email}" style="width: 250px" required="true" requiredMessage="Please insert  Email">
                                                    <f:validator validatorId="checkvalidemail"/>
                                                </p:inputText>
                                            </td>
                                            <td>
                                                <p:message for="email"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <h4 style="width: 160px; color: #191919" >Address :<strong style="color: red">*</strong> </h4>
                                            </td>
                                            <td>
                                                <p:inputText  id="address" value="#{adminVihicleBean.empAdd.address}" style="width: 250px" required="true" requiredMessage="Please insert  address">
                                                    <f:validateLength for="address" minimum="5" />
                                                </p:inputText>
                                            </td>
                                            <td>
                                                <p:message  for="address" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <h4 style="width: 160px; color: #191919" >Position :<strong style="color: red">*</strong> </h4>
                                            </td>
                                            <td>
                                                <h:selectOneMenu id="position" value="#{adminVihicleBean.positionString}" title="select any one in this menu">
                                                    <f:selectItem id="s1" itemLabel="Admin" itemValue="Admin" />
                                                    <f:selectItem id="s2" itemLabel="Employee" itemValue="Employee" />
                                                </h:selectOneMenu>
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <h4 style="width: 160px; color: #191919" >Choice Brand :<strong style="color: red"></strong> </h4>
                                            </td>
                                            <td>
                                                <h:selectOneMenu id="city" value="#{adminVihicleBean.brandNameAddEmp}">
                                                    <f:selectItems value="#{addVehicle.listBrand}" />
                                                </h:selectOneMenu>
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>

                                            </td>
                                            <td>
                                                <h:commandButton  action="#{adminVihicleBean.addnewEmp}" value="SUBMIT" style="width: 120px; height: 50px; font-size: 1.5em;font-weight: bold;" />

                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                    </table>

                                </div>
                            </h:column>
                        </h:panelGrid>

                        <!--                    </p:panel>-->
                        <p:panel id="p1" rendered="#{adminVihicleBean.emp.position!=1}" header="Sorry" footer="sorry">
                            Sorry Ban khong co quyen vao trang nay
                            <a href="login.xhtml">Home</a>
                        </p:panel>
                    </div>
                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
